const path = require('path');

module.exports = {
  webpack: {
    configure: (webpackConfig) => {
      webpackConfig.module.rules.push({
        test: /\.less$/,
        use: [
          'style-loader',
          'css-loader',
          {
            loader: 'postcss-loader',
            options: {
              postcssOptions: {
                plugins: [
                  require('postcss-px-to-rem')({
                    rootValue: 16,
                    propList: ['*'],
                    selectorBlackList: ['.ignore', '.hairlines'],
                    minPixelValue: 2,
                    mediaQuery: false,
                  }),
                ],
              },
            },
          },
          'less-loader',
        ],
        include: path.resolve(__dirname, 'src'),
      });

      return webpackConfig;
    },
  },
};